String clazzTpl({package}) => """
import 'package:flutter/material.dart';

/// 单行文字的高度
double textHeight(BuildContext context, TextStyle style) {
  TextPainter painter = TextPainter(
      locale: Localizations.localeOf(context),
      maxLines: 1,
      textDirection: TextDirection.ltr,
      text: TextSpan(
        text: "字高",
        style: style,
      ));
  painter.layout(maxWidth: double.infinity);
  return painter.height;
}

/// 多行高计算
Size textSize(BuildContext context, String text, TextStyle style,
    {int maxLines = 2 ^ 31, double maxWidth = double.infinity}) {
  if (text.isEmpty) {
    return Size.zero;
  }
  final TextPainter textPainter = TextPainter(
    textDirection: TextDirection.ltr,
    locale: Localizations.localeOf(context),
    text: TextSpan(text: text, style: style),
    maxLines: maxLines,
  )..layout(maxWidth: maxWidth);
  return textPainter.size;
}
""";
